package com.by.car.feign;


import com.by.car.service.CarService;
import com.by.common.core.bean.ResultBean;
import com.by.common.core.response.R;
import com.by.feign.client.CarRemoteClient;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 购物车提供的远程服务调用接口
 */
@RestController
@Tag(name = "购物车对外接口")
@Slf4j
public class CarFeignController implements CarRemoteClient {
    @Autowired
    CarService carService;

    @Override
    public ResultBean querySelectGoodsFromCar(int userId) {
        List list=carService.querySelectGoodsFromCar(userId);
        return R.success("购物信息",list);
    }

    @Override
    public ResultBean cleanCar(int userId) {
        int n=carService.cleanCar(userId);
        return R.success("下单后删除购物车数据",n);
    }
}
